package com.online.shopping.controller;

import com.online.shopping.service.ItemSearchService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * @author Rui
 * @version 1.0
 * @date 2020/11/20 13:31
 */
@RestController
@CrossOrigin
@Slf4j
public class ItemSearchController {

    @Autowired
    private ItemSearchService itemSearchService;

    @RequestMapping("/search")
    public Map search(@RequestBody Map searchMap) {
        log.info(String.valueOf(searchMap));
        log.info(String.valueOf(itemSearchService.search(searchMap)));
        return itemSearchService.search(searchMap);
    }

    @GetMapping("/testQuery")
    public void testQuery() {
        itemSearchService.testQuery();
        return;
    }
}